﻿

using System.ComponentModel;
using Microsoft.AspNetCore.Http;
using MiniExcelLibs.Attributes;
using Rong.EasyExcel.Attributes;
using Simple.Services.System.Office.Model;

namespace Simple.Services
{
    public class ChildrenInputModel : ModelBase
    {
        /// <summary>
        /// 主键
        /// </summary>
        public Guid? Id { get; set; }

        /// <summary>
        /// 幼儿姓名
        /// </summary>
        [Required(ErrorMessage = "幼儿姓名不能为空")]
        public string Name { get; set; } = "";

        /// <summary>
        /// 学号
        /// </summary>
        public string? StudentNumber { get; set; }

        /// <summary>
        /// 出生日期
        /// </summary>
        [Required(ErrorMessage = "出生日期不能为空")]
        public DateTime? Birthday { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        [Required(ErrorMessage = "性别不能为空")]
        public GenderType? Gender { get; set; } = GenderType.Male;

        /// <summary>
        /// 家庭地址
        /// </summary>
        public string? HomeAddress { get; set; }

        /// <summary>
        /// 所在班级
        /// </summary>
        public string? ClassesId { get; set; }

        public List<ChildParentInputDto> childParentInputList { get; set; } = new List<ChildParentInputDto>();

        public override void ConfigureMapper(Profile profile)
        {
            profile.CreateMap<Childrens, ChildrenInputModel>();

            profile.CreateMap<ChildrenInputModel, Childrens>();

        }
    }
}

public class ChildParentInputDto
{
    /// <summary>
    /// 家属id
    /// </summary>
    public Guid ParentId { get; set; }

    /// <summary>
    /// 家长关系
    /// </summary>
    public EnumParentRelationship Relationship { get; set; }
}


public class DeleteRelationInput
{
    /// <summary>
    /// 家属id
    /// </summary>
    public Guid ParentId { get; set; }

    public Guid ChildId { get; set; }
}

public class ChildrenImportInput
{
    [ExcelIgnore]
    public Guid? ChildId { get; set; }

    /// <summary>
    /// 幼儿姓名
    /// </summary>
    [ExcelColumn(Name = "幼儿姓名")]
    public string? Name { get; set; }

    /// <summary>
    /// 班级
    /// </summary>
    [ExcelColumn(Name = "班级")]
    public string? ClassesName { get; set; }

    [ExcelIgnore]
    public string? ClassId { get; set; }

    /// <summary>
    /// 学号
    /// </summary>
    [ExcelColumn(Name = "学号")]
    public string? StudentNumber { get; set; }

    /// <summary>
    /// 出生日期
    /// </summary>
    [ExcelColumn(Name = "出生日期")]
    [DataStyle(DataFormat = "yyyy-mm-dd hh:mm:ss")]
    public DateTime? Birthday { get; set; }

    /// <summary>
    /// 性别
    /// </summary>
    [ExcelColumn(Name = "性别")]
    public string? Gender { get; set; }

    /// <summary>
    /// 家属关系
    /// </summary>
    [ExcelColumn(Name = "家属关系A")]
    public string? RelationshipA { get; set; }

    /// <summary>
    /// 家属姓名
    /// </summary>
    [ExcelColumn(Name = "家属姓名A")]
    public string? ParentNameA { get; set; }

    /// <summary>
    /// 家属手机
    /// </summary>
    [ExcelColumn(Name = "家属手机A")]
    public string? ParentPhoneA { get; set; }

    /// <summary>
    /// 家属关系
    /// </summary>
    [ExcelColumn(Name = "家属关系B")]
    public string? RelationshipB { get; set; }

    /// <summary>
    /// 家属姓名
    /// </summary>
    [ExcelColumn(Name = "家属姓名B")]
    public string? ParentNameB { get; set; }

    /// <summary>
    /// 家属手机
    /// </summary>
    [ExcelColumn(Name = "家属手机B")]
    public string? ParentPhoneB { get; set; }

    /// <summary>
    /// 家属关系
    /// </summary>
    [ExcelColumn(Name = "家属关系C")]
    public string? RelationshipC { get; set; }

    /// <summary>
    /// 家属姓名
    /// </summary>
    [ExcelColumn(Name = "家属姓名C")]
    public string? ParentNameC { get; set; }

    /// <summary>
    /// 家属手机
    /// </summary>
    [ExcelColumn(Name = "家属手机C")]
    public string? ParentPhoneC { get; set; }

    /// <summary>
    /// 家属关系
    /// </summary>
    [ExcelColumn(Name = "家属关系D")]
    public string? RelationshipD { get; set; }

    /// <summary>
    /// 家属姓名
    /// </summary>
    [ExcelColumn(Name = "家属姓名D")]
    public string? ParentNameD { get; set; }

    /// <summary>
    /// 家属手机
    /// </summary>
    [ExcelColumn(Name = "家属手机D")]
    public string? ParentPhoneD { get; set; }

    [ExcelIgnore]
    public List<ParentImportDto> ParentImportList { get; set; }
}

public class ParentImportDto
{
    /// <summary>
    /// 家属id
    /// </summary>
    public Guid? ParentId { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public Guid? ChildId { get; set; }

    /// <summary>
    /// 家长关系
    /// </summary>
    public EnumParentRelationship Relationship { get; set; }

    /// <summary>
    /// 家属姓名
    /// </summary>
    public string? ParentName { get; set; }

    /// <summary>
    /// 家属手机
    /// </summary>
    public string? ParentPhone { get; set; }
}

public class ChildrenAvatarDto
{
    /// <summary>
    /// 图片集合
    /// </summary>
    public List<IFormFile>? ImageList { get; set; } = null;
}
